package cn.com.lms.business.attendance.persistence.repository;

import cn.com.lms.business.attendance.persistence.entity.Clockin;
import com.bnzj.core.persistence.repository.BaseRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

@Repository
public interface ClockinRepository extends BaseRepository<Clockin, Long> {

    @Query(value = "SELECT ifnull(min(clockin_time),'') clockinTime FROM bnz_clockin where substr(clockin_time,1,10) = ?1 and sign = '1'", nativeQuery = true)
    List<Map<String, Object>> getShangbanClockinTime(String date);

    @Query(value = "SELECT ifnull(max(clockin_time),'') clockinTime FROM bnz_clockin where substr(clockin_time,1,10) = ?1 and sign = '2'", nativeQuery = true)
    List<Map<String, Object>> getXiabanClockinTime(String date);

}
